package dilmaj.client;

import javax.jdo.annotations.*;

import dilmaj.shared.AreaVO;
import dilmaj.shared.CommentVO;

@PersistenceCapable
public class CommentJDO {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
    
    @Persistent
	private String text;
    
    @Persistent
	private Long userId;
    
    @Persistent
	private String userName;
    
    @Persistent
	private String anyUser;
    
    public CommentJDO() {
    
    }
    
    public CommentJDO(CommentVO commentVO) {
    	id=commentVO.getId();
    	
    	if (commentVO.getText()==null)
    		text="";
    	else
    		text=commentVO.getText();

		if (commentVO.getUserID()==null)
			userId=new Long(0);
		else
			userId=commentVO.getUserID();
		
		if (commentVO.getUsername()==null)
			userName="";
		else
			userName=commentVO.getUsername();
		
		if (commentVO.getAnyUser()==null)
			anyUser="";
		else
			anyUser=commentVO.getAnyUser();
    }
    
    public CommentJDO(String text) {
    	this.text=text;
    }
	
	public void setText(String newText) {
		text=newText;
	}
	
	public Long getId() {
		return id;
	}
	
	public String getText() {
		return text;
	}
	
	public String getAnyUser() {
		return anyUser;
	}
	
	public String getUsername() {
		return userName;
	}
	
	public Long getUserID() {
		return userId;
	}
}
